#!/usr/bin/python
import maptools.minimap
import sys
import os


import argparse

def isdir(string):
	if not os.path.isdir(string):
		msg = "%r is not direcotory" % string
		raise argparse.ArgumentTypeError(msg)
	else:
		return os.path.abspath(string)
if __name__ == "__main__":
	argv = sys.argv

	parser = argparse.ArgumentParser(description='Add minimap on photo using coordinate in EXIF and geotiff map')
	parser.add_argument("MAP_PATH",type=argparse.FileType("r"),nargs=1,help="Path to map in geotiff format")
	parser.add_argument("DIR_PATH",type=isdir, nargs=1, help="Path to directory with photos")
	args = parser.parse_args()

	maptools.minimap.minimap_create(args.MAP_PATH[0].name,args.DIR_PATH[0])
